package com.zw.yzk.kabu.data.repository;

import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.BuyExhibitionTicketEntity;
import com.zw.yzk.kabu.data.network.service.BuyExhibitionTicketService;
import com.zw.yzk.kabu.data.network.task.BuyExhibitionTicketTask;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2016/12/24.
 */

public class BuyExhibitionTicketRepository extends CommonRepository {

    @Inject
    public BuyExhibitionTicketRepository() {

    }

    @Override
    protected Observable connectServer(Task task) {
        BuyExhibitionTicketService loginService = ServiceGenerator.createService(BuyExhibitionTicketService.class);

        return loginService.buyTicket((BuyExhibitionTicketTask) task);
    }

    @Override
    protected Func1<BuyExhibitionTicketEntity, Observable> getServerData() {
        return new Func1<BuyExhibitionTicketEntity, Observable>() {
            @Override
            public Observable call(BuyExhibitionTicketEntity entity) {
                return Observable.just(entity);
            }
        };
    }

}
